package com.jigu.common;

import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;

public class  JsonResult implements Serializable{

    private int code;

    private String msg;

    private JSONObject data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public JSONObject getData() {
        return data;
    }

    public void setData(JSONObject data) {
        this.data = data;
    }

    public JsonResult(int code, String msg, JSONObject data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }


    public static JsonResult createEorrrMsg(String msg){
        JsonResult jsonResult = new JsonResult(500, msg, null);
        return jsonResult;
    }


    public static JsonResult createSuccusseMsg(JSONObject data){
        JsonResult jsonResult = new JsonResult(200, "成功", data);
        return jsonResult;
    }
}
